import 'package:flutter_test/flutter_test.dart';
import 'package:lmmi/common/utils/video_picker_util.dart';

void main() {
  group('VideoPickerUtil Tests', () {
    test('formatFileSize should format bytes correctly', () {
      expect(VideoPickerUtil.formatFileSize(500), '500 B');
      expect(VideoPickerUtil.formatFileSize(1536), '1.5 KB');
      expect(VideoPickerUtil.formatFileSize(1048576), '1.0 MB');
      expect(VideoPickerUtil.formatFileSize(1073741824), '1.0 GB');
    });

    test('formatFileSize should handle edge cases', () {
      expect(VideoPickerUtil.formatFileSize(0), '0 B');
      expect(VideoPickerUtil.formatFileSize(1023), '1023 B');
      expect(VideoPickerUtil.formatFileSize(1024), '1.0 KB');
      expect(VideoPickerUtil.formatFileSize(1048575), '1024.0 KB');
    });

    test('videoExists should return true for network URLs', () async {
      final result = await VideoPickerUtil.videoExists(
        'https://example.com/video.mp4',
      );
      expect(result, true);
    });

    test('videoExists should return true for http URLs', () async {
      final result = await VideoPickerUtil.videoExists(
        'http://example.com/video.mp4',
      );
      expect(result, true);
    });

    test('videoExists should handle invalid paths gracefully', () async {
      final result = await VideoPickerUtil.videoExists(
        '/nonexistent/path/video.mp4',
      );
      expect(result, false);
    });
  });
}
